<!DOCTYPE html>
<html>
<head>
    <title>附件管理</title>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <link rel="stylesheet" href="../../css/bootstrap.min.css">
    <link rel="stylesheet" href="../../css/font-awesome.min.css">
    <link rel="stylesheet" href="../../plugins/jqgrid/ui.jqgrid-bootstrap.css">
    <link rel="stylesheet" href="../../css/main.css">
    <script src="../../libs/jquery.min.js"></script>
    <script src="../../plugins/layer/layer.js"></script>
    <script src="../../libs/bootstrap.min.js"></script>
    <script src="../../libs/vue.min.js"></script>
    <script src="../../plugins/jqgrid/grid.locale-cn.js"></script>
    <script src="../../plugins/jqgrid/jquery.jqGrid.min.js"></script>
    <script src="../../js/common.js"></script>
    <script src="../../libs/ajaxupload.js"></script>
</head>
<body>
<div id="rapp" v-cloak>
    <div v-show="showList">
        <div class="grid-btn">
            <div class="form-group col-sm-2">
                <input type="text" class="form-control" v-model="q.title" @keyup.enter="query" placeholder="标题">
            </div>
            <div class="form-group col-sm-2">
                <select class="form-control" v-model="q.mime_type">
                    <option value="">选择类型</option>
                    <option value="application">文件</option>
                    <option value="image">图像</option>
                    <option value="audio">音频</option>
                    <option value="video">视频</option>
                </select>
            </div>
            <a class="btn btn-default" @click="query"><i class="fa fa-search">&nbsp;查询</i></a>

            <a v-if="hasPermission('sys:attachment:upload')" class="btn btn-primary" id="upload"><i
                    class="fa fa-upload"></i>&nbsp;上传文件</a>
            <a v-if="hasPermission('sys:attachment:download')" class="btn btn-success" @click="download"><i
                    class="fa fa-download"></i>&nbsp;下载文件</a>
            <a v-if="hasPermission('sys:attachment:info')" class="btn btn-info" @click="info"><i class="fa fa-info"></i>&nbsp;查看</a>
            <a v-if="hasPermission('sys:attachment:delete')" class="btn btn-danger" @click="del"><i
                    class="fa fa-trash-o"></i>&nbsp;删除</a>
        </div>
        <table id="jqGrid"></table>
        <div id="jqGridPager"></div>
    </div>

    <!--查看附件-->
    <div id="attachmentInfoLayer" style="display: none;">
        <form class="form-horizontal">
            <div class="form-group">
                <div class="col-sm-2 control-label">标题</div>
                <span class="label label-success" style="vertical-align: bottom;">{{attachment.title}}</span>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">缩略图</div>
                <span v-if="mimeType.indexOf('image') >= 0">
					<img class="img-thumbnail" style="width: 250px;height: 250px;"
                         :src="attachment.path">
				</span>
                <span v-if="mimeType.indexOf('audio') >= 0">
					<img class="img-thumbnail" style="width: 250px;height: 250px;" :src="baseURL+'/image/audio.jpg'">
				</span>
                <span v-if="mimeType.indexOf('video') >= 0">
					<img class="img-thumbnail" style="width: 250px;height: 250px;" :src="baseURL+'/image/video.jpg'">
				</span>
                <span v-if="mimeType.indexOf('application') >= 0">
					<img class="img-thumbnail" style="width: 250px;height: 250px;" :src="baseURL+'/image/file.jpg'">
				</span>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">路径</div>
                <span class="label label-success" style="vertical-align: bottom;">{{attachment.path}}</span>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">后缀</div>
                <span class="label label-success" style="vertical-align: bottom;">{{attachment.suffix}}</span>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">类型</div>
                <span class="label label-success" style="vertical-align: bottom;">{{attachment.mimeType}}</span>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">创建时间</div>
                <span class="label label-success" style="vertical-align: bottom;">{{attachment.createTime}}</span>
            </div>
        </form>
    </div>

</div>

<script src="../../js/modules/sys/attachment.js?v=0.2"></script>
</body>
</html>